package com.ruoyi.project.lely.bean.entity;

import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDate;
import java.time.LocalDateTime;
import javax.validation.constraints.NotNull;
import org.hibernate.validator.constraints.Length;

/**
 * 优惠券用户使用
 *
 * @author luoyong
 */
@Builder
@AllArgsConstructor
@NoArgsConstructor
@Data
@TableName(value = "`ly_coupon_user`", autoResultMap = true)
public class LyCouponUser {


    @ApiModelProperty("ID")
    @TableId("id")
    private Long id;


    @NotNull
    @ApiModelProperty("用户ID")
    @TableField(value = "`user_id`")
    private Integer userId;


    @NotNull
    @ApiModelProperty("优惠券ID")
    @TableField(value = "`coupon_id`")
    private Integer couponId;


    @ApiModelProperty("使用状态, 如果是0则未使用；如果是1则已使用；如果是2则已过期；如果是3则已经下架；")
    @TableField(value = "`status`")
    private Integer status;


    @ApiModelProperty("使用时间")
    @TableField(value = "`used_time`")
    private LocalDateTime usedTime;


    @ApiModelProperty("有效期开始时间")
    @TableField(value = "`start_time`")
    private LocalDate startTime;


    @ApiModelProperty("有效期截至时间")
    @TableField(value = "`end_time`")
    private LocalDate endTime;


    @Length(max = 63, message = "订单编号长度不能超过63位")
    @ApiModelProperty("订单编号")
    @TableField(value = "`order_sn`")
    private String orderSn;


    @ApiModelProperty("创建时间")
    @TableField(value = "`create_time`", fill = FieldFill.INSERT)
    private LocalDateTime createTime;


    @ApiModelProperty("更新时间")
    @TableField(value = "`update_time`", fill = FieldFill.INSERT_UPDATE)
    private LocalDateTime updateTime;


    @ApiModelProperty("逻辑删除")
    @TableField(value = "`deleted`", fill = FieldFill.INSERT)
    private Integer deleted;

}
